<div class="hbox hbox-auto-xs hbox-auto-sm" ng-init="
    app.settings.asideFolded = false;
    app.settings.asideDock = false;
  ">
    <!-- main -->
    <div class="col">
        <!-- main header -->
        <div class="bg-light lter b-b wrapper-md">
            <div class="row">
                <div class="col-sm-6 col-xs-12">
                    <h1 class="m-n font-thin h3 text-black">LDAP GROUPS</h1>
                    <!--<small class="text-muted">可访问堡垒机列表管理</small>-->
                </div>
            </div>
        </div>
        <!-- / main header -->
        <div class="wrapper-md">
            <!-- toaster directive -->
            <toaster-container
                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
            <div ng-controller="ldapGroupCtrl">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <form class="form-inline" role="form">
                            <div class="form-group">
                                <div class="input-group">
                                    <span class="input-group-addon">组名</span>
                                    <input type="text" class="form-control" ng-model="queryName"
                                           placeholder="名称">
                                </div>
                            </div>
                            <div class="form-group">
                                <button type="button" class="btn btn-info" ng-click="doQuery()"><span
                                        class="glyphicon glyphicon-search"></span>搜索
                                </button>
                                <button type="button" class="btn btn-success" ng-click="createGroup()"><span
                                        class="glyphicon glyphicon-plus"></span>创建LDAP组
                                </button>
                            </div>
                        </form>
                        <div style="margin-top: 5px;">
                            <table class="table table-hover table-bordered table-striped">
                                <thead>
                                <tr>
                                    <td class="col-md-3">LDAP组名</td>
                                    <td >绑定用户</td>
                                    <td class="col-md-2">操作</td>
                                </tr>
                                </thead>
                                <tbody>
                                <tr ng-repeat="item in pageData">
                                    <td>
                                        {{item.cn}}
                                        <b class="pull-right">{{item.content}}</b>
                                        </br>
                                        <b style="color: #777" ng-if="item.groupType == 0">普通用户组</b>
                                        <b style="color: #ec971f" ng-if="item.groupType == 1">特殊用户组</b>
                                        <b style="color: #286090" ng-if="item.groupType == 2">平台管理员</b>
                                        <b style="color: #843534" ng-if="item.groupType == 3">超级管理员</b>
                                        <b class="pull-right">用户组类型</b>
                                        </br>
                                        <b style="color: #20a03f" ng-if="item.workflow">是</b>
                                        <b style="color: #ef2929" ng-if="!item.workflow">否</b>
                                        <b class="pull-right">允许工作流申请</b>
                                        </br>
                                        <b class="badge" style="color: #ef2929">{{item.userList.length}}</b>
                                        <b class="pull-right">成员数量</b>
                                    </td>
                                    <td>
                                        <div class="col-md-6" ng-repeat="user in item.userList">
                                            <b style="margin-left: 5px; color: #286090">
                                                {{user.username}}<{{user.displayName}}:{{user.mail}}></b>
                                        </div>
                                    </td>
                                    <td>
                                        <button ng-click="userList(item)"
                                                class="btn btn-xs"
                                                style="margin-left: 5px; background-color: #2e6da4; color: white;">
                                            <span class="icon icon-users"></span>成员管理
                                        </button>

                                        <button ng-click="delLdapGroup(item.id)"
                                                class="btn btn-xs pull-right"
                                                style="background-color: red; color: white;">
                                            <span class="glyphicon glyphicon-remove"></span>删除
                                        </button>

                                    </td>
                                </tr>
                                </tbody>
                                <tfoot>
                                <tr>
                                    <td colspan="7">
                                        <ul style="margin: 0px; float: right;" uib-pagination
                                            total-items="totalItems" ng-model="currentPage"
                                            items-per-page="pageLength" max-size="10" ng-change="pageChanged()"
                                            previous-text="&lsaquo;" next-text="&rsaquo;"></ul>
                                    </td>
                                </tr>
                                </tfoot>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            </uib-tabset>
        </div>
    </div>
    <!-- / main -->
</div>

<script type="text/ng-template" id="ldapGroupModal">
    <div ng-include="'tpl/modal/ldap/ldap_group_info_modal.html'"></div>
</script>

<!--<script type="text/ng-template" id="keyBoxServerModal">-->
    <!--<div ng-include="'tpl/modal/keybox/keybox_server_modal.html'"></div>-->
<!--</script>-->

<script type="text/ng-template" id="ldapGroupUsersModal">
    <div ng-include="'tpl/modal/ldap/ldap_group_user_modal.html'"></div>
</script>

